<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/8/15
 * Time: 11:42
 */

namespace App\Console\Service\IPProxyPool\Uitl;

use Monolog\Logger;
use Monolog\Handler\StreamHandler;

/**
 * Class Monolog
 */
class Monolog
{

    /**
     * @var Logger
     */
    private static $log;

    /**
     * @param $func
     * @param $arguments
     * @throws \Exception
     */
    public static function __callStatic($func, $arguments)
    {
        if (empty(self::$log)) {
            $log = new Logger('name');
            $log->pushHandler(new StreamHandler('storage/logs/master.log', Logger::DEBUG));
            self::$log = $log;
        }
        echo $arguments[0].PHP_EOL;
        self::$log->$func($arguments[0]);
    }

    /**
     * @throws \Exception
     */
    public static function setPath()
    {
        self::$log->pushHandler(new StreamHandler('storage/logs/worker.log', Logger::DEBUG));
        $dd = self::$log->getHandlers();
        dd($dd);
    }

}
